<template>
<div>
  <ul>
    <li v-for="(item,i) in list" :key="i">
      <span>{{item}}</span>
    <button @click="del(i)">删除</button>
    </li>
  </ul>
  <button @click="add">生成</button>

</div>
</template>

<script>
export default{
  data(){
    return{
      list:[]
    }
  },
  methods:{
    add(){
   this.list.push(Math.floor(Math.random()*20))
    },
  del(i){
  this.list.splice(i,1)
  }
  }
}
</script>

